/********************************************************************
FileName    :   Dal_yw_pdbB.cs
CreateTime  :   2015-09-18 12:09
BaseClass   :   Dal_yw_pdbB
FileType    :   .cs
Author      :  minjie
Description :   Dal_yw_pdbBDAL层（简单三层）
*********************************************************************/

using System;
using System.Text;
using System.Data.SqlClient;
using System.Collections.Generic;

using System.Data;
namespace OS.DAL
{
	/// <summary>
	/// Dal_yw_pdbB的摘要说明。
	/// </summary>
	public partial class Dal_yw_pdbB 
  	{ 
     		      
  		public bool Exists(int DjBth) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select count(1) from yw_pdbB"); 
  			strSql.Append(" where "); 
           SqlParameter[] parameters = { new SqlParameter("@DjBth", SqlDbType.Int,4)};  
  			return DbHelperSQL.Exists(strSql.ToString(),parameters); 
  		} 
  		 
  				 
  		 
  		/// <summary> 
  		/// 增加一条数据 
  		/// </summary> 
  		public  bool  Add(yw_pdbB_Entity model) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("insert into yw_pdbB(");			 
  	strSql.Append("DjLsh,DjBth,DjState,hh,spbh,cjhh,spmc,sptm,gysbh,dw,flh,flmc,xlbh,xlmc,dj,pfj,jj,pdsl,pdje,pdjjje,kcsl,kcje,kcsjje,yksl,ykje,ykjjje,hzk,hbz) values ("); 
  	strSql.Append("	@DjLsh,@DjBth,@DjState,@hh,@spbh,@cjhh,@spmc,@sptm,@gysbh,@dw,@flh,@flmc,@xlbh,@xlmc,@dj,@pfj,@jj,@pdsl,@pdje,@pdjjje,@kcsl,@kcje,@kcsjje,@yksl,@ykje,@ykjjje,@hzk,@hbz	 ) "); 
  			SqlParameter[] parameters = { 
              new SqlParameter("@DjLsh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjBth", SqlDbType.Int,4) ,              
              new SqlParameter("@DjState", SqlDbType.Char,10) ,              
              new SqlParameter("@hh", SqlDbType.Int,4) ,              
              new SqlParameter("@spbh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@cjhh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@spmc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@sptm", SqlDbType.VarChar,50) ,              
              new SqlParameter("@gysbh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@dw", SqlDbType.VarChar,50) ,              
              new SqlParameter("@flh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@flmc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@xlbh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@xlmc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@dj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@pfj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@jj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@pdsl", SqlDbType.Decimal,9) ,              
              new SqlParameter("@pdje", SqlDbType.Decimal,9) ,              
              new SqlParameter("@pdjjje", SqlDbType.Decimal,9) ,              
              new SqlParameter("@kcsl", SqlDbType.Decimal,9) ,              
              new SqlParameter("@kcje", SqlDbType.Decimal,9) ,              
              new SqlParameter("@kcsjje", SqlDbType.Decimal,9) ,              
              new SqlParameter("@yksl", SqlDbType.Decimal,9) ,              
              new SqlParameter("@ykje", SqlDbType.Decimal,9) ,              
              new SqlParameter("@ykjjje", SqlDbType.Decimal,9) ,              
              new SqlParameter("@hzk", SqlDbType.Decimal,9) ,              
              new SqlParameter("@hbz", SqlDbType.VarChar,50)};             
              parameters[0].Value = model.DjLsh;  
              
              parameters[1].Value = model.DjBth;  
              
           if (model.DjState != null)  
              parameters[2].Value = model.DjState;  
           else  
              parameters[2].Value = DBNull.Value;  
              
              parameters[3].Value = model.hh;  
              
           if (model.spbh != null)  
              parameters[4].Value = model.spbh;  
           else  
              parameters[4].Value = DBNull.Value;  
              
           if (model.cjhh != null)  
              parameters[5].Value = model.cjhh;  
           else  
              parameters[5].Value = DBNull.Value;  
              
           if (model.spmc != null)  
              parameters[6].Value = model.spmc;  
           else  
              parameters[6].Value = DBNull.Value;  
              
           if (model.sptm != null)  
              parameters[7].Value = model.sptm;  
           else  
              parameters[7].Value = DBNull.Value;  
              
           if (model.gysbh != null)  
              parameters[8].Value = model.gysbh;  
           else  
              parameters[8].Value = DBNull.Value;  
              
           if (model.dw != null)  
              parameters[9].Value = model.dw;  
           else  
              parameters[9].Value = DBNull.Value;  
              
           if (model.flh != null)  
              parameters[10].Value = model.flh;  
           else  
              parameters[10].Value = DBNull.Value;  
              
           if (model.flmc != null)  
              parameters[11].Value = model.flmc;  
           else  
              parameters[11].Value = DBNull.Value;  
              
           if (model.xlbh != null)  
              parameters[12].Value = model.xlbh;  
           else  
              parameters[12].Value = DBNull.Value;  
              
           if (model.xlmc != null)  
              parameters[13].Value = model.xlmc;  
           else  
              parameters[13].Value = DBNull.Value;  
              
           if (model.dj != null)  
              parameters[14].Value = model.dj;  
           else  
              parameters[14].Value = DBNull.Value;  
              
           if (model.pfj != null)  
              parameters[15].Value = model.pfj;  
           else  
              parameters[15].Value = DBNull.Value;  
              
           if (model.jj != null)  
              parameters[16].Value = model.jj;  
           else  
              parameters[16].Value = DBNull.Value;  
              
           if (model.pdsl != null)  
              parameters[17].Value = model.pdsl;  
           else  
              parameters[17].Value = DBNull.Value;  
              
           if (model.pdje != null)  
              parameters[18].Value = model.pdje;  
           else  
              parameters[18].Value = DBNull.Value;  
              
           if (model.pdjjje != null)  
              parameters[19].Value = model.pdjjje;  
           else  
              parameters[19].Value = DBNull.Value;  
              
           if (model.kcsl != null)  
              parameters[20].Value = model.kcsl;  
           else  
              parameters[20].Value = DBNull.Value;  
              
           if (model.kcje != null)  
              parameters[21].Value = model.kcje;  
           else  
              parameters[21].Value = DBNull.Value;  
              
           if (model.kcsjje != null)  
              parameters[22].Value = model.kcsjje;  
           else  
              parameters[22].Value = DBNull.Value;  
              
           if (model.yksl != null)  
              parameters[23].Value = model.yksl;  
           else  
              parameters[23].Value = DBNull.Value;  
              
           if (model.ykje != null)  
              parameters[24].Value = model.ykje;  
           else  
              parameters[24].Value = DBNull.Value;  
              
           if (model.ykjjje != null)  
              parameters[25].Value = model.ykjjje;  
           else  
              parameters[25].Value = DBNull.Value;  
              
           if (model.hzk != null)  
              parameters[26].Value = model.hzk;  
           else  
              parameters[26].Value = DBNull.Value;  
              
           if (model.hbz != null)  
              parameters[27].Value = model.hbz;  
           else  
              parameters[27].Value = DBNull.Value;  
              
  			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);			 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
              return false;; 
           }  
  		} 
  		 
  		/// <summary> 
  		/// 增加一条数据(字符串) 
  		/// </summary> 
  		public  string  AddStr(yw_pdbB_Entity model) 
  		{ 
  				if(model.DjLsh==null) 
  				{ 
  					model.DjLsh=0; 
  				} 
  				if(model.DjBth==null) 
  				{ 
  					model.DjBth=0; 
  				} 
  				if(model.DjState==null) 
  				{ 
  					model.DjState="";  
  				} 
  				if(model.hh==null) 
  				{ 
  					model.hh=0; 
  				} 
  				if(model.spbh==null) 
  				{ 
  					model.spbh="";  
  				} 
  				if(model.cjhh==null) 
  				{ 
  					model.cjhh="";  
  				} 
  				if(model.spmc==null) 
  				{ 
  					model.spmc="";  
  				} 
  				if(model.sptm==null) 
  				{ 
  					model.sptm="";  
  				} 
  				if(model.gysbh==null) 
  				{ 
  					model.gysbh="";  
  				} 
  				if(model.dw==null) 
  				{ 
  					model.dw="";  
  				} 
  				if(model.flh==null) 
  				{ 
  					model.flh="";  
  				} 
  				if(model.flmc==null) 
  				{ 
  					model.flmc="";  
  				} 
  				if(model.xlbh==null) 
  				{ 
  					model.xlbh="";  
  				} 
  				if(model.xlmc==null) 
  				{ 
  					model.xlmc="";  
  				} 
  				if(model.dj==null) 
  				{ 
  					model.dj=0; 
  				} 
  				if(model.pfj==null) 
  				{ 
  					model.pfj=0; 
  				} 
  				if(model.jj==null) 
  				{ 
  					model.jj=0; 
  				} 
  				if(model.pdsl==null) 
  				{ 
  					model.pdsl=0; 
  				} 
  				if(model.pdje==null) 
  				{ 
  					model.pdje=0; 
  				} 
  				if(model.pdjjje==null) 
  				{ 
  					model.pdjjje=0; 
  				} 
  				if(model.kcsl==null) 
  				{ 
  					model.kcsl=0; 
  				} 
  				if(model.kcje==null) 
  				{ 
  					model.kcje=0; 
  				} 
  				if(model.kcsjje==null) 
  				{ 
  					model.kcsjje=0; 
  				} 
  				if(model.yksl==null) 
  				{ 
  					model.yksl=0; 
  				} 
  				if(model.ykje==null) 
  				{ 
  					model.ykje=0; 
  				} 
  				if(model.ykjjje==null) 
  				{ 
  					model.ykjjje=0; 
  				} 
  				if(model.hzk==null) 
  				{ 
  					model.hzk=0; 
  				} 
  				if(model.hbz==null) 
  				{ 
  					model.hbz="";  
  				} 
  		 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("insert into yw_pdbB(");			 
  	strSql.Append("DjLsh,DjBth,DjState,hh,spbh,cjhh,spmc,sptm,gysbh,dw,flh,flmc,xlbh,xlmc,dj,pfj,jj,pdsl,pdje,pdjjje,kcsl,kcje,kcsjje,yksl,ykje,ykjjje,hzk,hbz) values ("); 
  	strSql.Append("	"+ model.DjLsh+","+ model.DjBth+",'"+ model.DjState+"',"+ model.hh+",'"+ model.spbh+"','"+ model.cjhh+"','"+ model.spmc+"','"+ model.sptm+"','"+ model.gysbh+"','"+ model.dw+"','"+ model.flh+"','"+ model.flmc+"','"+ model.xlbh+"','"+ model.xlmc+"',"+ model.dj+","+ model.pfj+","+ model.jj+","+ model.pdsl+","+ model.pdje+","+ model.pdjjje+","+ model.kcsl+","+ model.kcje+","+ model.kcsjje+","+ model.yksl+","+ model.ykje+","+ model.ykjjje+","+ model.hzk+",'" +model.hbz+"'	 ) "); 
           return strSql.ToString(); 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 更新一条数据 
  		/// </summary> 
  		public bool Update(yw_pdbB_Entity model) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("update yw_pdbB set "); 
              strSql.Append(" DjLsh = @DjLsh,"); 
              strSql.Append(" DjBth = @DjBth,"); 
              strSql.Append(" DjState = @DjState,"); 
              strSql.Append(" hh = @hh,"); 
              strSql.Append(" spbh = @spbh,"); 
              strSql.Append(" cjhh = @cjhh,"); 
              strSql.Append(" spmc = @spmc,"); 
              strSql.Append(" sptm = @sptm,"); 
              strSql.Append(" gysbh = @gysbh,"); 
              strSql.Append(" dw = @dw,"); 
              strSql.Append(" flh = @flh,"); 
              strSql.Append(" flmc = @flmc,"); 
              strSql.Append(" xlbh = @xlbh,"); 
              strSql.Append(" xlmc = @xlmc,"); 
              strSql.Append(" dj = @dj,"); 
              strSql.Append(" pfj = @pfj,"); 
              strSql.Append(" jj = @jj,"); 
              strSql.Append(" pdsl = @pdsl,"); 
              strSql.Append(" pdje = @pdje,"); 
              strSql.Append(" pdjjje = @pdjjje,"); 
              strSql.Append(" kcsl = @kcsl,"); 
              strSql.Append(" kcje = @kcje,"); 
              strSql.Append(" kcsjje = @kcsjje,"); 
              strSql.Append(" yksl = @yksl,"); 
              strSql.Append(" ykje = @ykje,"); 
              strSql.Append(" ykjjje = @ykjjje,"); 
              strSql.Append(" hzk = @hzk,"); 
              strSql.Append(" hbz = @hbz"); 
  			strSql.Append(" where  DjBth=@DjBth "); 
  						 
  SqlParameter[] parameters = { 
              new SqlParameter("@DjLsh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjBth", SqlDbType.Int,4) ,              
              new SqlParameter("@DjState", SqlDbType.Char,10) ,              
              new SqlParameter("@hh", SqlDbType.Int,4) ,              
              new SqlParameter("@spbh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@cjhh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@spmc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@sptm", SqlDbType.VarChar,50) ,              
              new SqlParameter("@gysbh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@dw", SqlDbType.VarChar,50) ,              
              new SqlParameter("@flh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@flmc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@xlbh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@xlmc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@dj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@pfj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@jj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@pdsl", SqlDbType.Decimal,9) ,              
              new SqlParameter("@pdje", SqlDbType.Decimal,9) ,              
              new SqlParameter("@pdjjje", SqlDbType.Decimal,9) ,              
              new SqlParameter("@kcsl", SqlDbType.Decimal,9) ,              
              new SqlParameter("@kcje", SqlDbType.Decimal,9) ,              
              new SqlParameter("@kcsjje", SqlDbType.Decimal,9) ,              
              new SqlParameter("@yksl", SqlDbType.Decimal,9) ,              
              new SqlParameter("@ykje", SqlDbType.Decimal,9) ,              
              new SqlParameter("@ykjjje", SqlDbType.Decimal,9) ,              
              new SqlParameter("@hzk", SqlDbType.Decimal,9) ,              
              new SqlParameter("@hbz", SqlDbType.VarChar,50)};             
              parameters[0].Value = model.DjLsh;  
              
              parameters[1].Value = model.DjBth;  
              
           if (model.DjState != null)  
              parameters[2].Value = model.DjState;  
           else  
              parameters[2].Value = DBNull.Value;  
              
              parameters[3].Value = model.hh;  
              
           if (model.spbh != null)  
              parameters[4].Value = model.spbh;  
           else  
              parameters[4].Value = DBNull.Value;  
              
           if (model.cjhh != null)  
              parameters[5].Value = model.cjhh;  
           else  
              parameters[5].Value = DBNull.Value;  
              
           if (model.spmc != null)  
              parameters[6].Value = model.spmc;  
           else  
              parameters[6].Value = DBNull.Value;  
              
           if (model.sptm != null)  
              parameters[7].Value = model.sptm;  
           else  
              parameters[7].Value = DBNull.Value;  
              
           if (model.gysbh != null)  
              parameters[8].Value = model.gysbh;  
           else  
              parameters[8].Value = DBNull.Value;  
              
           if (model.dw != null)  
              parameters[9].Value = model.dw;  
           else  
              parameters[9].Value = DBNull.Value;  
              
           if (model.flh != null)  
              parameters[10].Value = model.flh;  
           else  
              parameters[10].Value = DBNull.Value;  
              
           if (model.flmc != null)  
              parameters[11].Value = model.flmc;  
           else  
              parameters[11].Value = DBNull.Value;  
              
           if (model.xlbh != null)  
              parameters[12].Value = model.xlbh;  
           else  
              parameters[12].Value = DBNull.Value;  
              
           if (model.xlmc != null)  
              parameters[13].Value = model.xlmc;  
           else  
              parameters[13].Value = DBNull.Value;  
              
           if (model.dj != null)  
              parameters[14].Value = model.dj;  
           else  
              parameters[14].Value = DBNull.Value;  
              
           if (model.pfj != null)  
              parameters[15].Value = model.pfj;  
           else  
              parameters[15].Value = DBNull.Value;  
              
           if (model.jj != null)  
              parameters[16].Value = model.jj;  
           else  
              parameters[16].Value = DBNull.Value;  
              
           if (model.pdsl != null)  
              parameters[17].Value = model.pdsl;  
           else  
              parameters[17].Value = DBNull.Value;  
              
           if (model.pdje != null)  
              parameters[18].Value = model.pdje;  
           else  
              parameters[18].Value = DBNull.Value;  
              
           if (model.pdjjje != null)  
              parameters[19].Value = model.pdjjje;  
           else  
              parameters[19].Value = DBNull.Value;  
              
           if (model.kcsl != null)  
              parameters[20].Value = model.kcsl;  
           else  
              parameters[20].Value = DBNull.Value;  
              
           if (model.kcje != null)  
              parameters[21].Value = model.kcje;  
           else  
              parameters[21].Value = DBNull.Value;  
              
           if (model.kcsjje != null)  
              parameters[22].Value = model.kcsjje;  
           else  
              parameters[22].Value = DBNull.Value;  
              
           if (model.yksl != null)  
              parameters[23].Value = model.yksl;  
           else  
              parameters[23].Value = DBNull.Value;  
              
           if (model.ykje != null)  
              parameters[24].Value = model.ykje;  
           else  
              parameters[24].Value = DBNull.Value;  
              
           if (model.ykjjje != null)  
              parameters[25].Value = model.ykjjje;  
           else  
              parameters[25].Value = DBNull.Value;  
              
           if (model.hzk != null)  
              parameters[26].Value = model.hzk;  
           else  
              parameters[26].Value = DBNull.Value;  
              
           if (model.hbz != null)  
              parameters[27].Value = model.hbz;  
           else  
              parameters[27].Value = DBNull.Value;  
              
              int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters); 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
  				return false; 
  			} 
  		}


     

        /// <summary> 
        /// 删除一条数据 
        /// </summary> 
        public bool Delete(int  DjBth) 
  		{ 
  			 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("delete from yw_pdbB "); 
  			strSql.Append(" where  DjBth=@DjBth"); 
  			SqlParameter[] parameters = {  new SqlParameter("@DjBth", SqlDbType.Int,4) };  
    parameters[0].Value = DjBth;  
   
  			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters); 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
  				return false; 
  			} 
  		} 
  		 
  		/// <summary> 
  		/// 批量删除一批数据 
  		/// </summary> 
  		public bool DeleteList(string DjBthlist ) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("delete from yw_pdbB "); 
  			strSql.Append(" where ID in ("+DjBthlist + ")  "); 
  			int rows=DbHelperSQL.ExecuteSql(strSql.ToString()); 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
  				return false; 
  			} 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 得到一个对象实体 
  		/// </summary> 
  		public yw_pdbB_Entity GetModel(int   DjBth) 
  		{ 
  			 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select  DjLsh,DjBth,DjState,hh,spbh,cjhh,spmc,sptm,gysbh,dw,flh,flmc,xlbh,xlmc,dj,pfj,jj,pdsl,pdje,pdjjje,kcsl,kcje,kcsjje,yksl,ykje,ykjjje,hzk,hbz");	
		strSql.Append("  from yw_pdbB"); 
  			strSql.Append(" where  DjBth=@DjBth "); 
  			SqlParameter[] parameters = {  new SqlParameter("@DjBth", SqlDbType.Int,4) };  
    parameters[0].Value = DjBth;  
  			 
  			yw_pdbB_Entity model=new yw_pdbB_Entity(); 
  			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); 
  			 
  			if(ds!=null&&ds.Tables[0].Rows.Count>0) 
  			{ 
  		DataTable dt=ds.Tables[0];	  
  				if(dt.Rows[0]["DjLsh"]!=null&&dt.Rows[0]["DjLsh"].ToString()!="") 
  				{ 
  					model.DjLsh=int.Parse(dt.Rows[0]["DjLsh"].ToString()); 
  				} 
  				if(dt.Rows[0]["DjBth"]!=null&&dt.Rows[0]["DjBth"].ToString()!="") 
  				{ 
  					model.DjBth=int.Parse(dt.Rows[0]["DjBth"].ToString()); 
  				} 
  				model.DjState= dt.Rows[0]["DjState"].ToString(); 
  				if(dt.Rows[0]["hh"]!=null&&dt.Rows[0]["hh"].ToString()!="") 
  				{ 
  					model.hh=int.Parse(dt.Rows[0]["hh"].ToString()); 
  				} 
  				model.spbh= dt.Rows[0]["spbh"].ToString(); 
  				model.cjhh= dt.Rows[0]["cjhh"].ToString(); 
  				model.spmc= dt.Rows[0]["spmc"].ToString(); 
  				model.sptm= dt.Rows[0]["sptm"].ToString(); 
  				model.gysbh= dt.Rows[0]["gysbh"].ToString(); 
  				model.dw= dt.Rows[0]["dw"].ToString(); 
  				model.flh= dt.Rows[0]["flh"].ToString(); 
  				model.flmc= dt.Rows[0]["flmc"].ToString(); 
  				model.xlbh= dt.Rows[0]["xlbh"].ToString(); 
  				model.xlmc= dt.Rows[0]["xlmc"].ToString(); 
  				if(dt.Rows[0]["dj"]!=null&&dt.Rows[0]["dj"].ToString()!="") 
  				{ 
  					model.dj=decimal.Parse(dt.Rows[0]["dj"].ToString()); 
  				} 
  				if(dt.Rows[0]["pfj"]!=null&&dt.Rows[0]["pfj"].ToString()!="") 
  				{ 
  					model.pfj=decimal.Parse(dt.Rows[0]["pfj"].ToString()); 
  				} 
  				if(dt.Rows[0]["jj"]!=null&&dt.Rows[0]["jj"].ToString()!="") 
  				{ 
  					model.jj=decimal.Parse(dt.Rows[0]["jj"].ToString()); 
  				} 
  				if(dt.Rows[0]["pdsl"]!=null&&dt.Rows[0]["pdsl"].ToString()!="") 
  				{ 
  					model.pdsl=decimal.Parse(dt.Rows[0]["pdsl"].ToString()); 
  				} 
  				if(dt.Rows[0]["pdje"]!=null&&dt.Rows[0]["pdje"].ToString()!="") 
  				{ 
  					model.pdje=decimal.Parse(dt.Rows[0]["pdje"].ToString()); 
  				} 
  				if(dt.Rows[0]["pdjjje"]!=null&&dt.Rows[0]["pdjjje"].ToString()!="") 
  				{ 
  					model.pdjjje=decimal.Parse(dt.Rows[0]["pdjjje"].ToString()); 
  				} 
  				if(dt.Rows[0]["kcsl"]!=null&&dt.Rows[0]["kcsl"].ToString()!="") 
  				{ 
  					model.kcsl=decimal.Parse(dt.Rows[0]["kcsl"].ToString()); 
  				} 
  				if(dt.Rows[0]["kcje"]!=null&&dt.Rows[0]["kcje"].ToString()!="") 
  				{ 
  					model.kcje=decimal.Parse(dt.Rows[0]["kcje"].ToString()); 
  				} 
  				if(dt.Rows[0]["kcsjje"]!=null&&dt.Rows[0]["kcsjje"].ToString()!="") 
  				{ 
  					model.kcsjje=decimal.Parse(dt.Rows[0]["kcsjje"].ToString()); 
  				} 
  				if(dt.Rows[0]["yksl"]!=null&&dt.Rows[0]["yksl"].ToString()!="") 
  				{ 
  					model.yksl=decimal.Parse(dt.Rows[0]["yksl"].ToString()); 
  				} 
  				if(dt.Rows[0]["ykje"]!=null&&dt.Rows[0]["ykje"].ToString()!="") 
  				{ 
  					model.ykje=decimal.Parse(dt.Rows[0]["ykje"].ToString()); 
  				} 
  				if(dt.Rows[0]["ykjjje"]!=null&&dt.Rows[0]["ykjjje"].ToString()!="") 
  				{ 
  					model.ykjjje=decimal.Parse(dt.Rows[0]["ykjjje"].ToString()); 
  				} 
  				if(dt.Rows[0]["hzk"]!=null&&dt.Rows[0]["hzk"].ToString()!="") 
  				{ 
  					model.hzk=decimal.Parse(dt.Rows[0]["hzk"].ToString()); 
  				} 
  				model.hbz= dt.Rows[0]["hbz"].ToString(); 
  				return model; 
  			} 
  			else 
  			{ 
  				return null; 
  			} 
  		} 
  		 
  		/// <summary> 
  		/// 分页获取数据列表 
  		/// </summary> 
  		public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  		 strSql.Append("SELECT * FROM ( "); 
  		 strSql.Append(" SELECT ROW_NUMBER() OVER ("); 
  if (!string.IsNullOrEmpty(orderby.Trim())) 
 { 
    strSql.Append("order by T." + orderby); 
 } 
else  
 { 
     strSql.Append("order by T.DjBth desc"); 
 } 
		 strSql.Append(")AS Row, T.*  from yw_pdbB T "); 
  		 if (!string.IsNullOrEmpty(strWhere.Trim()))  
  			{ 
  			 strSql.Append(" WHERE " + strWhere); 
  			} 
  		    strSql.Append(" ) TT"); 
  	        strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);			return DbHelperSQL.Query(strSql.ToString()); 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public DataSet GetList(string strWhere) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select * "); 
  			strSql.Append(" FROM yw_pdbB "); 
  			if(strWhere.Trim()!="") 
  			{ 
  				strSql.Append(" where "+strWhere); 
  			} 
  			return DbHelperSQL.Query(strSql.ToString()); 
  		} 
  		 
  		/// <summary> 
  		/// 获得前几行数据 
  		/// </summary> 
  		public DataSet GetList(int Top,string strWhere,string filedOrder) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select "); 
  			if(Top>0) 
  			{ 
  				strSql.Append(" top "+Top.ToString()); 
  			} 
  			strSql.Append(" * "); 
  			strSql.Append(" FROM yw_pdbB "); 
  			if(strWhere.Trim()!="") 
  			{ 
  				strSql.Append(" where "+strWhere); 
  			} 
  			strSql.Append(" order by " + filedOrder); 
  			return DbHelperSQL.Query(strSql.ToString()); 
  		} 
  		 
  		/// <summary> 
  		/// 获得记录条数 
  		/// </summary> 
  		public int GetRecordCount(string strWhere) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select count(1) "); 
  			strSql.Append(" FROM yw_pdbB "); 
  			if(strWhere.Trim()!="") 
  			{ 
  				strSql.Append(" where "+strWhere); 
  			} 
  		   object obj=	DbHelperSQL.GetSingle(strSql.ToString()); 
  			if(obj!=null && obj.ToString()!="") 
  			{ 
              	return Convert.ToInt32(obj); 
  			} 
  			else 
  			return 0; 
  		} 
   
      
  	} 
  
}
